package com.starry.module.system.core.oauth2.service.impl;

import com.starry.module.system.core.oauth2.entity.Oauth2ThirdUser;
import com.starry.module.system.core.oauth2.mapper.Oauth2ThirdUserMapper;
import com.starry.module.system.core.oauth2.service.Oauth2ThirdUserService;
import org.springframework.stereotype.Service;

/**
 * 第三方用户绑定关联-服务实现
 *
 * @author xiaoke
 */
@Service("oauth2ThirdUserService")
public class Oauth2ThirdUserServiceImpl implements Oauth2ThirdUserService {

    private final Oauth2ThirdUserMapper oauth2ThirdUserMapper;

    public Oauth2ThirdUserServiceImpl(Oauth2ThirdUserMapper oauth2ThirdUserMapper) {
        this.oauth2ThirdUserMapper = oauth2ThirdUserMapper;
    }

    @Override
    public Oauth2ThirdUser get(String openid, String thirdType, Integer userType) {
        return oauth2ThirdUserMapper.selectOne(openid, thirdType, userType);
    }

    @Override
    public void save(Oauth2ThirdUser oauth2ThirdUser) {
        oauth2ThirdUserMapper.insert(oauth2ThirdUser);
    }
}

